import axios from "axios";
import router from "@/router";

const ajax = axios.create({
  baseURL: "/"
});

ajax.interceptors.response.use(response => {
  if (response.status == 200) {
    if (response.data.code === -2) {
      router.push("/login");
    }
    return response.data;
  }
});

export default ajax;
